/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sonatype.mavenbook.weather;

import java.io.InputStream;
import org.apache.log4j.PropertyConfigurator;

/**
 *
 * @author JHS-Home
 */
public class Main {

    public static void main(String[] args) {
        PropertyConfigurator.configure(Main.class.getClassLoader().getResource("log4j.properties"));
        System.out.println("Simple 1.1");
        String zipcode = "02101";
        try {
            zipcode = args[0];
            new Main(zipcode).start();
        }catch(Exception e){
            
            
        }
    }
    private String zip = null;
    
    public Main(String zip){
        this.zip = zip;
    }
    
    public void start() throws Exception{
        InputStream dataIn = new YahooRetriever().retrieve(zip);
        
        Weather weather = new YahooParser().parse(dataIn);
        
        System.out.print( new WeatherFormatter().format(weather));
    }
}
